package cn.wolfcode.luowowo.common.util;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 异步请求返回对象
 */
@Setter
@Getter
public class AjaxResult implements Serializable {

    //是success 的功能拓展, 暂时没用
    private int code;       //返回参数码

    private String msg;     //返回信息

    private Object data;    //返回数据

    private boolean success = true;    //返回状态


    public AjaxResult() {

    }

    public AjaxResult(String msg) {
        this.success = false;
        this.msg = msg;
    }

    public AjaxResult(String msg, int code) {
        this.success = false;
        this.msg = msg;
        this.code = code;
    }

    public AjaxResult(boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }


    public AjaxResult addData(Object data) {
        this.data = data;
        return this;
    }

    public AjaxResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }


}
